﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Wicresoft.IDE.Shell
{
    public partial class NewForm : Wicresoft.IDE.Components.Controls.RichForm
    {
        public NewForm()
        {
            InitializeComponent();

            templateLV.SelectedIndices.Add(0);
        }

        private void Category_AfterSelect(object sender, TreeViewEventArgs e)
        {

        }

        private void Template_SelectedChanged(object sender, EventArgs e)
        {
            if (templateLV.SelectedItems.Count != 0)
            {
                descriptionTB.Text = templateLV.SelectedItems[0].Tag.ToString();
                openBtn.Enabled = true;
            }
            else
            {
                descriptionTB.Text = null;
                openBtn.Enabled = false;
            }
        }

        private void Open_Click(object sender, EventArgs e)
        {
            if (templateLV.SelectedItems.Count != 0)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }

        private void Cancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void Template_DoubleClick(object sender, EventArgs e)
        {
            Open_Click(sender, e);
        }
    }
}
